package com.hongdee.insurance.car.dao.impl;

import com.hongdee.base.basedao.impl.BaseDaoImpl;
import com.hongdee.insurance.car.dao.ITInsuranceCarDao;
import com.hongdee.insurance.car.entity.TInsuranceCar;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 名  称:TInsuranceDaoImpl
 * 类  型:class
 * 描  述:
 * 路  径:com.hongdee.insurance.car.dao.impl
 * 作  者: 术洪超
 * 日  期:2017-04-25 10:08
 */
@Service
public class TInsuranceCarDaoImpl extends BaseDaoImpl implements ITInsuranceCarDao {
    /**
     * 获得车主档案信息
     * @param id
     * @return
     * @throws Exception
     */
    @Override
    public TInsuranceCar getCarInfo(String id) throws Exception {
        String hql="from TInsuranceCar where id=:id";
        Map<String,Object> params=new HashMap<>();
        params.put("id",id);
        return (TInsuranceCar) this.getHibernateDao().findEntityByHqlWithParams(hql,params);
    }

    @Override
    public TInsuranceCar getCarInfoByVin(String vin) throws Exception {
        String hql="from TInsuranceCar where vin=:vin";
        Map<String,Object> params=new HashMap<>();
        params.put("vin",vin);
        return (TInsuranceCar) this.getHibernateDao().findEntityByHqlWithParams(hql,params);
    }
}
